
package std.unittest.common
import std.collection.*

import std.convert.Parsable
import std.sync.ReentrantMutex
import std.collection.ArrayList
import std.collection.fold
import std.collection.enumerate
import std.convert.Formattable

@!APILevel[
    since: "22"
]
public interface KeyFor<T> {
    @!APILevel[
        since: "22"
    ]
    prop name: String
}

@!APILevel[
    since: "22"
]
public struct KeyTags <: KeyFor<Array<String>> {
    @!APILevel[
        since: "22"
    ]
    public static prop tags: KeyTags
    
    @!APILevel[
        since: "22"
    ]
    public prop name: String
}

@!APILevel[
    since: "22"
]
sealed abstract class ConfigurationKey <: Equatable<ConfigurationKey> & Hashable {
    @!APILevel[
        since: "22"
    ]
    public override func hashCode(): Int64
    
    @!APILevel[
        since: "22"
    ]
    public override operator func ==(that: ConfigurationKey)
    
    @!APILevel[
        since: "22"
    ]
    public override operator func !=(that: ConfigurationKey)
}

extend ConfigurationKey {
    @!APILevel[
        since: "22"
    ]
    public static func create<T>(name: String): ConfigurationKey
}

@!APILevel[
    since: "22"
]
public class Configuration <: ToString {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func get<T>(key: KeyFor<T>): ?T
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func getByName<T>(name: String): ?T
    
    /**
    * @throws IllegalArgumentException
    * @throws UnittestOptionValidationException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func set<T>(key: KeyFor<T>, value: T): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws UnittestOptionValidationException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func setByName<T>(name: String, value: T): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove<T>(key: KeyFor<T>): ?T
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeByName<T>(key: String): ?T
    
    @!APILevel[
        since: "22"
    ]
    public func clone(): Configuration
    
    /**
    * @throws ConcurrentModificationException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func merge(parent: Configuration, child: Configuration): Configuration
}

@!APILevel[
    since: "22"
]
public interface DataProvider<T> {
    @!APILevel[
        since: "22"
    ]
    func provide(): Iterable<T>
}

@!APILevel[
    since: "22"
]
public interface DataShrinker<T> {
    @!APILevel[
        since: "22"
    ]
    func shrink(value: T): Iterable<T>
}

@!APILevel[
    since: "22"
]
public interface DataStrategy<T> {
    @!APILevel[
        since: "22"
    ]
    func provider(configuration: Configuration): DataProvider<T>
    
    @!APILevel[
        since: "22"
    ]
    func shrinker(configuration: Configuration): DataShrinker<T>
    
    @!APILevel[
        since: "22"
    ]
    prop isInfinite: Bool
}

extend<T> Array<T> <: DataStrategy<T> & DataProvider<T> {
    @!APILevel[
        since: "22"
    ]
    public func provide(): Iterable<T>
    
    @!APILevel[
        since: "22"
    ]
    public prop isInfinite: Bool
    
    @!APILevel[
        since: "22"
    ]
    public func provider(_: Configuration): DataProvider<T>
}

extend<T> Range<T> <: DataStrategy<T> & DataProvider<T> {
    @!APILevel[
        since: "22"
    ]
    public func provide(): Iterable<T>
    
    @!APILevel[
        since: "22"
    ]
    public prop isInfinite: Bool
    
    @!APILevel[
        since: "22"
    ]
    public func provider(_: Configuration): DataProvider<T>
}


extend DataModel <: ToJson {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func fromJson(jv: JsonValue): DataModel
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws JsonException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toJson(): JsonValue
}

@!APILevel[
    since: "22"
]
public class UnittestOptionValidationException <: Exception {
}

@!APILevel[
    since: "22"
]
public enum OptionValidity {
    @!APILevel[
        since: "22"
    ]
    UnknownOptionType |
    @!APILevel[
        since: "22"
    ]
    InvalidOption(String) |
    @!APILevel[
        since: "22"
    ]
    ValidOption(ConfigurationKey)
}

@!APILevel[
    since: "22"
]
type Validator = (Any) -> OptionValidity
@!APILevel[
    since: "22"
]
public var unittestOptionsRegistryClosed = false

@!APILevel[
    since: "22"
]
public struct OptionInfo {
}

@!APILevel[
    since: "22"
]
public let optionsInfo: HashMap<String, OptionInfo> = HashMap()

/**
* @throws IllegalArgumentException
* @throws NoneValueException
* @throws IllegalSynchronizationStateException
* @throws IndexOutOfBoundsException
* @throws UnittestOptionValidationException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func registerOptionValidator(name: String, validator: Validator): Unit

/**
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
* @throws IllegalSynchronizationStateException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func setOptionInfo(
    name: String,
    types: Array<String>,
    description!: ?String = None
): Unit

/**
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
* @throws NoneValueException
* @throws IllegalSynchronizationStateException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func setOrUpdateOptionInfo(
    name: String,
    description: ?String,
    ty: String,
    typeDescription: String
): Unit

@!APILevel[
    since: "22"
]
public enum Color <: Equatable<Color> {
    @!APILevel[
        since: "22"
    ]
    RED |
    @!APILevel[
        since: "22"
    ]
    GREEN |
    @!APILevel[
        since: "22"
    ]
    YELLOW |
    @!APILevel[
        since: "22"
    ]
    BLUE |
    @!APILevel[
        since: "22"
    ]
    CYAN |
    @!APILevel[
        since: "22"
    ]
    MAGENTA |
    @!APILevel[
        since: "22"
    ]
    GRAY |
    @!APILevel[
        since: "22"
    ]
    DEFAULT_COLOR
    @!APILevel[
        since: "22"
    ]
    public operator func ==(that: Color): Bool
    
    @!APILevel[
        since: "22"
    ]
    public operator func !=(that: Color)
}

@!APILevel[
    since: "22"
]
public abstract class PrettyPrinter {
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public PrettyPrinter(let indentationSize!: UInt64 = 4, let startingIndent!: UInt64 = 0)
    
    @!APILevel[
        since: "22"
    ]
    public prop isTopLevel: Bool
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func indent(body: () -> Unit): PrettyPrinter
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func indent(indents: UInt64, body: () -> Unit): PrettyPrinter
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func customOffset(symbols: UInt64, body: () -> Unit): PrettyPrinter
    
    @!APILevel[
        since: "22"
    ]
    public func colored(color: Color, body: () -> Unit): PrettyPrinter
    
    @!APILevel[
        since: "22"
    ]
    public open func fillLimitedSpace(spaceSize: Int64, body: () -> Unit): PrettyPrinter
    
    @!APILevel[
        since: "22"
    ]
    public func colored(color: Color, text: String): PrettyPrinter
    
    @!APILevel[
        since: "22"
    ]
    public func append(text: String): PrettyPrinter
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func appendCentered(text: String, space: UInt64): PrettyPrinter
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func appendLeftAligned(text: String, space: UInt64): PrettyPrinter
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func appendRightAligned(text: String, space: UInt64): PrettyPrinter
    
    @!APILevel[
        since: "22"
    ]
    public func append<PP>(value: PP): PrettyPrinter where PP <: PrettyPrintable
    
    @!APILevel[
        since: "22"
    ]
    public func newLine(): PrettyPrinter
    
    @!APILevel[
        since: "22"
    ]
    public func appendLine(text: String): PrettyPrinter
    
    @!APILevel[
        since: "22"
    ]
    public func appendLine<PP>(value: PP): PrettyPrinter where PP <: PrettyPrintable
}

@!APILevel[
    since: "22"
]
public class PrettyText <: PrettyPrinter & PrettyPrintable & ToString {
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init()
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(string: String)
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func of<PP>(pp: PP) where PP <: PrettyPrintable
    
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    @!APILevel[
        since: "22"
    ]
    public func pprint(to: PrettyPrinter): PrettyPrinter
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

@!APILevel[
    since: "22"
]
public interface PrettyPrintable {
    @!APILevel[
        since: "22"
    ]
    func pprint(to: PrettyPrinter): PrettyPrinter
}

extend<T> Array<T> <: PrettyPrintable where T <: PrettyPrintable {
    @!APILevel[
        since: "22"
    ]
    public func pprint(to: PrettyPrinter): PrettyPrinter
}

extend<T> ArrayList<T> <: PrettyPrintable where T <: PrettyPrintable {
    @!APILevel[
        since: "22"
    ]
    public func pprint(to: PrettyPrinter): PrettyPrinter
}

extend Color <: Serializable<Color> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws Exception
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Color
}

extend PrettyPrintableTextChunk <: Serializable<PrettyPrintableTextChunk> {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws Exception
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): PrettyPrintableTextChunk
}

extend PrettyText <: Serializable<PrettyText> {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): PrettyText
}

extend Int64 <: Serializable<Int64> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Int64
}

extend Int32 <: Serializable<Int32> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Int32
}

extend Int16 <: Serializable<Int16> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Int16
}

extend Int8 <: Serializable<Int8> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Int8
}

extend UInt64 <: Serializable<UInt64> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): UInt64
}

extend UInt32 <: Serializable<UInt32> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): UInt32
}

extend UInt16 <: Serializable<UInt16> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): UInt16
}

extend UInt8 <: Serializable<UInt8> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): UInt8
}

extend Float64 <: Serializable<Float64> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Float64
}

extend Float32 <: Serializable<Float32> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Float32
}

extend Float16 <: Serializable<Float16> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Float16
}

extend Bool <: Serializable<Bool> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Bool
}

extend String <: Serializable<String> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): String
}

extend Rune <: Serializable<Rune> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws Exception
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Rune
}

extend<T> Option<T> <: Serializable<Option<T>> where T <: Serializable<T> {
    @!APILevel[
        since: "22"
    ]
    public func serializeInternal(): DataModel
    
    @!APILevel[
        since: "22"
    ]
    public static func deserialize(dm: DataModel): Option<T>
}

extend<T> Array<T> <: Serializable<Array<T>> where T <: Serializable<T> {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): Array<T>
}

extend<T> ArrayList<T> <: Serializable<ArrayList<T>> where T <: Serializable<T> {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): ArrayList<T>
}

extend<T> HashSet<T> <: Serializable<HashSet<T>> where T <: Serializable<T> & Hashable & Equatable<T> {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): HashSet<T>
}

extend<K, V> HashMap<K, V> <: Serializable<HashMap<K, V>>
    where K <: Serializable<K> & Hashable & Equatable<K>, V <: Serializable<V> {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func serializeInternal(): DataModel
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws DataModelException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func deserialize(dm: DataModel): HashMap<K, V>
}

extend Rune <: TextWidth {
    @!APILevel[
        since: "22"
    ]
    public func width(): Int64
}

extend String <: TextWidth {
    @!APILevel[
        since: "22"
    ]
    public func width(): Int64
}


